package net.superdvach.core;

import java.io.IOException;

import org.apache.log4j.PropertyConfigurator;

import net.superdvach.content.*;
import net.superdvach.network.NetworkLayerManager;
import net.superdvach.web.*;

public class Core {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		PropertyConfigurator.configure("log4j.properties");
		m_config = new Config("s2ch.conf");
		m_run = true;
		try {
			m_storage = new JDBCStorage(m_config);
			m_webClient = new WebClient();
			m_webClient.start();
			m_layerManager = new NetworkLayerManager();
			while(m_run); // wtf
			m_webClient.shutdown();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static Config getConfig() {
		return m_config;
	}

	public static String getVersionString() {
		return "0.1";
	}
	
	public static NetworkLayerManager getNetworkLayerManager() {
		return m_layerManager;
	}
	
	private static boolean m_run;
	
	private static Config m_config;
	private static ContentStorage m_storage;
	private static WebClient m_webClient;
	private static NetworkLayerManager m_layerManager;
}
